#include <iostream>
#include <list>
#include <iomanip>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false); //cin.tie(nullptr);
    int n, k, m;
    while(cin >> n >> k >> m && n!=0 && k!=0 && m !=0){
        int a[21]; fill(a, a+21, 0); for(int i=1; i<=n; ++i) a[i] = i;
        int left = n;
        int p1 = 0, p2 = n+1;
        while(left){
            int K = k, M = m;
            while(K){
                p1++;
                if(p1==n+1) p1 = 1;
                if(a[p1]) K--;
            }
            while(M){
                p2--;
                if(p2==0) p2 = n;
                if(a[p2]) M--;
            }
            if(p1 == p2) {
                left--;
                cout << setw(3) << a[p1];
                a[p1] = 0;
                if(left) cout << ",";
            }
            else{
                left -= 2;
                cout << setw(3) << a[p1] << setw(3) << a[p2];
                a[p1] = a[p2] = 0;
                if(left) cout << ",";
            }
        }
        cout << "\n";

    }
    return 0;
}
